home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52
/
Volume 52 - JOGO DISK .iso
/
Games
/
puppyred_ball_war.swf
/
scripts
/
DefineSprite_90
/
frame_1
/
DoAction.as
< prev
Wrap
Text File
|
2007-09-26
|
4KB
|
157 lines
function alldie()
{
_root.createEmptyMovieClip("mc_die",1010);
_root.mc_die.onEnterFrame = function()
{
_root.nexttime = _root.nexttime + 1;
if(_root.nexttime >= 30)
{
_root.gotoAndStop("ready");
_root.level = _root.level + 1;
_root.nexttime = 0;
_root.back.ma.gotoAndPlay(2);
_root.enemypoz.removeMovieClip();
this.removeMovieClip();
}
};
}
actNum = random(12);
speedX = random(10) / 5;
speedy = random(10) / 5;
a = 0;
b = 0;
percent = 5;
delayon = 0;
walkdelay = 0;
walktime = random(100) + 30;
plusminus = random(10);
if(plusminus < 2)
{
speedX *= -1;
speedY *= -1;
}
this.onEnterFrame = function()
{
if(_root.alldie == 1)
{
gotoAndStop(7);
}
if(!hiting & _root.alldie == 0)
{
if(actNum < percent & a == 0)
{
gotoAndStop(2);
a = 1;
}
if(actNum >= percent)
{
walkdelay++;
if(walkdelay < walktime)
{
if(this._y >= - 0.5833333333333334 * this._x + 330)
{
this._y = - 0.5833333333333334 * this._x + 330;
}
if(this._y < - 0.5833333333333334 * this._x + 330 | speedX < 0 | speedY < 0)
{
this.en.nextFrame();
if(this.en._currentframe == this.en._totalframes)
{
this.en.gotoAndStop(1);
}
this._x += speedX;
this._y += speedY;
if(this._x <= 0)
{
this._x = 0;
speedX *= -1;
}
if(this._y <= 0)
{
this._y = 0;
speedY *= -1;
}
}
}
if(walkdelay >= walktime & b == 0)
{
gotoAndStop(2);
b = 1;
}
}
if(this._currentframe == 2)
{
if(delayon == 0)
{
delaytime = random(50);
delayon = 1;
}
delay++;
if(delaytime <= delay)
{
gotoAndStop(3);
delay = 0;
point = new Object();
point.x = en._x;
point.y = en._y;
localToGlobal(point);
_root.z = _root.z + 1;
if(_root.z > 30)
{
_root.z = 1;
}
_root.enthrowpoz.attachMovie("enthrow2","enthrow" + _root.z,_root.z);
_root.enthrowpoz["enthrow" + _root.z]._x = point.x + 20;
_root.enthrowpoz["enthrow" + _root.z]._y = point.y + 10;
}
}
}
if(!die)
{
var s = 1;
while(s <= 5)
{
if(this.hitTest(_root.throwpoz["throw" + s]._x,_root.throwpoz["throw" + s]._y,true) && _root.throwpoz["throw" + s]._x != undefined)
{
_root.throwpoz["throw" + s].removeMovieClip();
this.hiting = true;
this.hitNum = this.hitNum + 1;
_root.score += 15;
if(_root.level < 5)
{
hitM = 2;
}
else
{
hitM = _root.level - 2;
}
if(hitNum == 1)
{
gotoAndStop(4);
}
if(hitNum > 1 && hitNum <= hitM)
{
die = true;
gotoAndStop(5);
}
if(hitNum >= hitM + 1)
{
die = true;
gotoAndStop(6);
hitNum = 0;
_root.endieNum = _root.endieNum + 1;
if(_root.endieNum >= 4 + (_root.level - 1) * 2 && _root.level < 5)
{
alldie();
}
else if(_root.endieNum >= 10)
{
alldie();
}
}
}
s++;
}
}
};